package com.tongcao.cn.contoller;

import com.tongcao.cn.exception.MyException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author:tongcao
 * @Date:2018/8/24 16:10
 * Description:
 */
@Controller
@RequestMapping("/error")
public class ExceptionController {

    @RequestMapping("/test1")
    public String error(ModelMap modelMap) throws Exception {
        throw new Exception("我报错啦");
    }

    @RequestMapping("/test2")
    public String error2(ModelMap modelMap) throws MyException {
        throw new MyException("400", "我也报错啦");
    }

    @RequestMapping("/errorPage")
    public String fowardToErrorPage(ModelMap modelMap) {

        return "error";
    }
}
